var url = serverPre + "/manager/yzt/v1/smsSendFlow";

var bsConf = {

    queryFormId: "smsSendFlow-query-form",

    createFormId: "smsSendFlow-create-form",

    updateFormId: "smsSendFlow-update-form",

    tableID: "id",

    queryCols: 3,

    queryFloat: "right",

    voName: "smsSendFlowInfo",
    initData: true,
    queryConfigs:                   //页面头部查询form
        [
            {
                type: 'text',
                label: '流水号',
                name: 'requestNo',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '系统标识',
                name: 'systemSign',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '子系统标识',
                name: 'subSystemSign',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '手机号',
                name: 'phone',
                default: '',
                verify: ''
            },
            {
                type: 'select',
                label: '状态',
                name: 'status',
                default: '',
                verify: '',
                cols: [[1, '成功'], [2, '失败']]
            },
            {
                type: 'datetime',
                label: '发送时间',
                name: 'createTimeStart',
                default: '',
                verify: ''
            },
            {
                type: 'datetime',
                label: '至',
                name: 'createTimeEnd',
                default: '',
                verify: ''
            }
        ],

    //列表内容
    tableCols: [
        // {type: 'checkbox'}
        {field: 'id', title: '序号', type: 'numbers'}
        , {field: 'requestNo', width: '10%', title: '流水号'}
        , {field: 'subSystemSign', width: '10%', title: '子系统标识'}
        , {field: 'phone', width: '10%', title: '手机号'}
        , {field: 'status', width: '10%', title: '发送状态'}
        , {field: 'createTime', width: '10%', title: '发送时间'}
        , {field: 'errorMsg', width: '10%', title: '错误信息'}
        , {field: 'smsCode', width: '10%', title: '短信验证码'}
        , {field: 'unlockTime', width: '10%', title: '锁定时间'}
        , {field: 'ip', width: '10%', title: '发送ip'}
        // , {fixed: 'right', width: 200, title: '操作',align: 'center', toolbar: '#barDemo'}
        , {
            fixed: 'right', field: 'action', width: '10%', title: '操作', templet: function (d) {
                if (d.unlockTime != null) {
                    return "" +
                        "  <button dataid='" + d.id + "' onclick=\"islock('" + d.phone + "','" + d.subSystemSign + "');\" class=\"layui-btn layui-btn-sm bs-button-update\">解锁</button>\n" +
                        "";
                }else{
                    return "";
                }
            }
        }
    ],
    enableBtns: true,
};

function islock(phone, subSystemSign){
    var content = "<div  style='margin-top: 50px;margin-left: 100px;margin-right:50px;font-size: 18px;line-height:25px' ><span style='font-size: 18px;'>" + "确定解除锁定？"+ "</span></div>";
    var index = layer.open({
        type: 1,
        title: '解除锁定',
        skin: 'layui-layer-molv',//样式类名
        shadeClose: true,
        shade: false,
        maxmin: true,
        btnAlign: 'c',//按钮居中
        content: content,
        area: ['350px', '200px'],
        btn: [ '确定','取消'],

        yes: function (index, layero) {
            unlock(phone, subSystemSign);
            layer.close(index);
        },
        cancel: function (index, layero) {
            layer.close(index);
        }

    });
}


function unlock(phone, subSystemSign) {
    var phone = phone;
    var subSystemSign = subSystemSign;
    $.ajax({
        type: "GET",
        url: serverPre + "/manager/yzt/v1/smsSendFlow/romove",
        headers: {"token": getCookie("token")},
        data: {phone: phone, subSystemSign: subSystemSign},
        dataType: "json",
        success: function (res) {
            if (res.code == 0) {
                layer.alert("解锁成功")

            } else {
                layer.alert("解锁失败")
            }
            layer.close(index);
            window.parent.location.reload();
        }
    })


}







